package com.example.zzk;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class RoosAdapter extends RecyclerView.Adapter<RoosAdapter.RoosViewHolder>{
    public RoosAdapter(List<RoomBean> data, Context context) {
        this.data = data;
        this.context = context;
    }

    private List<RoomBean> data;

    private Context context;

    @NonNull
    @Override
    public RoosAdapter.RoosViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = View.inflate( context,R.layout.roos_item,null);
        return new RoosViewHolder(view);


    }

    @Override
    public void onBindViewHolder(@NonNull RoosAdapter.RoosViewHolder holder, int position) {
        holder.tvid.setText(data.get(position).getId() + "");
//        holder.tvname.setText(data.get(position).getName());


    }

    @Override
    public int getItemCount() {
        return data == null ? 0 : data.size();
    }

    public class RoosViewHolder extends RecyclerView.ViewHolder {
        private TextView tvid, tvname;

        public RoosViewHolder(@NonNull View itemView) {
            super(itemView);
            tvid = itemView.findViewById(R.id.tv_id);
            tvname = itemView.findViewById(R.id.tv_name);
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                }
            });

        }
    }
}
